package com.bjh.service.impl;

import com.bjh.dao.WalletDao;
import com.bjh.service.WalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class WalletServiceImpl implements WalletService {
    @Autowired
    private WalletDao walletDao;

    /**
     * 获取代理商保证金
     * @param agentId 代理商id
     * @return {@link Map}
     * @throws Exception Exception
     */
    @Override
    public Map<String, Object> getBond(Long agentId) throws Exception {
        return walletDao.getBond(agentId);
    }

    /**
     * 获取代理商保证金记录
     * @param params 相关参数
     * @return {@link Map}
     * @throws Exception Exception
     */
    @Override
    public Map<String, Object> getBondLog(Map<String, Object> params) throws Exception {
        Map<String, Object> resMap = new HashMap<>();
        resMap.put("list",walletDao.getBondLog(params));
        resMap.put("count",walletDao.getBondLogCount(params));
        return resMap;
    }

    /**
     * 获取代理商钱包
     * @param agentId 代理商id
     * @return {@link Map}
     * @throws Exception Exception
     */
    @Override
    public Map<String, Object> getWallet(Long agentId) throws Exception {
        return walletDao.getWallet(agentId);
    }

    /**
     * 获取代理商钱包明细记录
     * @param params 相关参数
     * @return {@link Map}
     * @throws Exception Exception
     */
    @Override
    public Map<String, Object> getWalletLog(Map<String, Object> params) throws Exception {
        Map<String, Object> resMap = new HashMap<>();
        resMap.put("list",walletDao.getWalletLog(params));
        resMap.put("count",walletDao.getWalletLogCount(params));
        return resMap;
    }

    /**
     * 获取优惠券列表
     * @param params 相关参数
     * @return {@link Map}
     * @throws Exception Exception
     */
    @Override
    public Map<String, Object> getCouponList(Map<String, Object> params) throws Exception {
        Map<String, Object> resMap = new HashMap<>();
        resMap.put("list",walletDao.getCouponList(params));
        resMap.put("count",walletDao.getCouponCount(params));
        return resMap;
    }
}
